package org.lzh.service;

import org.lzh.dao.AnswerDao;
import org.lzh.pojo.Answer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AnswerService {

    //注入dao
    @Autowired
    protected AnswerDao answerDao;

    //新建问题
    public int insertAnswer(Answer answer){
        return answerDao.insertAnswer(answer);
    }

    //根据学生id查找答案
    public Answer findByStudentId(String studentId){
        return answerDao.findByStudentId(studentId);
    };

    //查询所有答案中的学生id 分询（通过数组）
    public List<String> findAllStudentId(){
        return answerDao.findAllStudentId();
    };

    //根据学生id和试卷id动态更新
    public int updateByStuidAndTestidDynamic(Answer answer){
        return answerDao.updateByStuidAndTestidDynamic(answer);
    };
}
